// 运输计划
import request from '@/utils/request1'
// 查询运输计划
function logisticsPlanList(query) {
  return request({
    url: '/logistics/transportTasks/list',
    method: 'get',
    params: query
  })
}
//   获取运输计划详细信息
export function getTransportPlanDetail(roleId) {
  return request({
    url: '/logistics/transportTasks/' + roleId,
    method: 'get'
  })
}
// 查询物流公司信息列表
export function logisticsCompanyoList(query) {
  return request({
    url: '/logistics/company/list',
    method: 'get',
    params: query
  })
}
// 查询起点终点
export function getByType(query) {
  return request({
    url: '/logistics/location/getByType',
    method: 'get',
    params: query
  })
}
// 查询车型
export function getVehicleModel(drivingVehicleType) {
  return request({
    url: `/system/dict/data/queryDictDetailByCode/${drivingVehicleType}`,
    method: 'get'
  })
}
// 查询供应商
export function supplierList(query) {
  return request({
    url: '/logistics/supplier/list',
    method: 'get',
    params: query
  })
}
// 查询物料信息
export function materialList(query) {
  return request({
    url: '/logistics/material/list',
    method: 'get',
    params: query
  })
}

// 查询审核信息
export function auditInfoList(moduleType, moduleId, query) {
  return request({
    url: '/logistics/auditInfo/queryListByTransportId',
    method: 'get',
    params: {
      ...query, // 保留 query 中的原始参数
      moduleType, // 新增 moduleType 参数
      moduleId // 新增 moduleId 参数
    }
  })
}
//   分配物流
export function getLogisticsBillDetail(roleId) {
  return request({
    url: '/logistics/logisticsBill/' + roleId,
    method: 'get'
  })
}
//   运单信息
export function getTransportBillDetail(roleId) {
  return request({
    url: '/logistics/transportBill/' + roleId,
    method: 'get'
  })
}
// 审核
export function auditTransportPlan(data) {
  return request({
    url: '/logistics/transportTasks/review',
    method: 'put',
    data
  })
}
// 修改状态
export function changeTransportPlanState(data) {
  return request({
    url: '/logistics/transportTasks/modifyState',
    method: 'put',
    data
  })
}
// 新增司机信息=================================================================
export function addDriver(data) {
  return request({
    url: '/logistics/driver',
    method: 'post',
    data: data
  })
}
//   修改司机信息
export function updateDriver(data) {
  return request({
    url: '/logistics/driver',
    method: 'put',
    data: data
  })
}
// 删除司机
export function delDriver(userId) {
  return request({
    url: '/logistics/driver/' + userId,
    method: 'delete'
  })
}

// 修改司机启用状态
export function setDriverEditEnabled(data) {
  return request({
    url: '/logistics/driver/editEnabled/' + data.ids + '/' + data.isEnabled,
    method: 'put'
  })
}
const obj = {
  logisticsPlanList,
  getTransportPlanDetail,
  getLogisticsBillDetail,
  getTransportBillDetail,
  auditTransportPlan,
  changeTransportPlanState,
  logisticsCompanyoList,
  auditInfoList,
  supplierList,
  materialList,
  getByType,
  getVehicleModel,
  addDriver,
  updateDriver,
  delDriver,
  setDriverEditEnabled
}
export default obj
